package negocio.basica;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;


public class principal {

	public static void main(String[] args) {
		try{
			Class.forName("org.postgresql.Driver");
			Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost/clinica_fsm","postgres","real");
			Statement stat = conn.createStatement();
			ResultSet nomes = stat.executeQuery("select p.*, pa.anotacoes, u.login,u.senha from tb_paciente pa " +
					"inner join tb_pessoa p on (p.codigo_pessoa = pa.codigo_pessoa)" +
					"inner join tb_usuario u on (u.codigo_pessoa = pa.codigo_pessoa)");
			while(nomes.next()){
				System.out.println(nomes.getString(1) + " " + nomes.getString(2)); 
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		
		
	}

}
